#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

#define ll long long
const int mod = 1000000007;

int c[5001][5001];
int n, k;

int main()
{
	c[0][0] = 1;
	for (int i = 1; i <= 5000; i++)
	{
		for (int j = 0; j <= i; j++)
		{                
			c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
			if (c[i][j] >= mod) c[i][j] -= mod;
		}
	}
	scanf("%d%d", &n, &k);
	while (n != 0 && k != 0)
	{
		if (k % 2 == 1)
        {
            ll f1 = c[n - 2][(k + 1) / 2 - 1];
            ll f2 = c[n - 2][(k + 1) / 2 - 1];
            f1 = (2ll * f1 * f2) % (ll)mod;
            printf("%d\n", (int)f1);
        }
        else
        {
            ll f1 = c[n - 2][(k + 1) / 2 - 1];
            ll f2 = c[n - 2][(k + 1) / 2];
            f1 = (2ll * f1 * f2) % (ll)mod;
            printf("%d\n", (int)f1);
        }
        scanf("%d%d", &n, &k);
	}
	return 0;
}

